package com.fafu.control;


import com.fafu.service.PowerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import util.Dictionary;
import util.JsonRsp;
import util.MyMap;

import java.util.Map;

@RestController()

@RequestMapping("/power")
@Api("权限相关")
public class PowerControl {
    private Logger logger = LoggerFactory.getLogger(PowerControl.class);
    @Autowired
    private PowerService powerService;

    @ApiOperation("获取权限列表")
    @RequestMapping(value = "/getPower",method = RequestMethod.GET)
    public JsonRsp getPower() {
        try{
            Map<String,Object> reMap = powerService.getPowerList(new MyMap().toMap());
            return JsonRsp.success(reMap.get("data"));
        }catch(Exception e){
            logger.error(""+e);
            return JsonRsp.fail(Dictionary.CODE.SYSTEM_ERROR, "system error");
        }
    }
}
